<template>
  <view>
	 <tui-navigation-bar :isOpacity="false" @init="initNavigation" @change="opacityChange" :scrollTop="scrollTop">
		<view class="tab-box">
			<view class="zhong">
				<view class="tab-box">
					<block v-for="(item,i) in tabList" :key="i">
						<view v-if="item.enabled" class="title-label" @click="tabsChange" :data-i="i" >
							<text
								:style="{fontWeight:current==i?'bold':'',fontSize:current==i?'36rpx':'28rpx'}">
								{{item.name}}
							</text> 
						</view> 
					</block>
				</view>
			</view>
		</view>
	 </tui-navigation-bar>
  </view>
</template>

<script>
	import tuiNavigationBar from "@/components/thorui/tui-navigation-bar/tui-navigation-bar.vue";
	export default {
		components: {
			tuiNavigationBar,
		},
		props: {
			currentValue: {
				type: Number,
				default: 0,
			},
			tabList: {
				type: Array,
				default: [],
			},
		},
		data() {
			return {
				top: 0, //标题图标距离顶部距离
				opacity: 1,
				height: 0,
				scrollTop: 0.5,
				
				current: 0, 
			}
		},
		computed: {
			
		},
		methods: {
			initNavigation(e) {
				this.height = e.height;
				this.opacity = e.opacity;
				this.top = e.top;
				this.$emit('initNav', e);
			},
			opacityChange(e) {
				this.opacity = e.opacity;
			},
			tabsChange(e) {
				this.current = e.currentTarget.dataset.i; 
				this.$emit('change', this.current);
			},
		}
	}
</script>

<style lang="scss" scoped>
	.zhong {
		//width: 230rpx;
	}
	
	.tab-box {
		display: flex;
		justify-content: center;
		align-items: center;
	}
	
	.avatar-box {
		display: flex;
		align-items: center;
		position: absolute;
		left: 40rpx;
		
		.icon {
			position: absolute;
			right: 0;
			bottom: 0;
		}
	}
	
	.tab-box .title-label {
		height: 44px;
		padding: 0 20rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		position: relative;
		//font-size: 34rpx;
	}
	
	.tab-box .title-label text {
		transition: all 0.3s;
	}
</style>